package animationCollision;

import java.awt.Graphics;

public abstract class Shape {
	float speedX, speedY; // Ball's speed per step in x and y (package access)

	/** Draw itself using the given graphics context. */
	public abstract void draw(Graphics g);

	/** Return the magnitude of speed. */
	float getSpeed() {
		return (float) Math.sqrt(speedX * speedX + speedY * speedY);
	}

	/** Return the direction of movement in degrees (counter-clockwise). */
	public float getMoveAngle() {
		return (float) Math.toDegrees(Math.atan2(-speedY, speedX));
	}

	/** Return mass */
	public abstract float getMass();

	/** Return the kinetic energy (0.5mv^2) */
	public float getKineticEnergy() {
		return 0.5f * getMass() * (speedX * speedX + speedY * speedY);
	}
	@Override
	public String toString() {
		return "Speed X = "+speedX +", Y = " +speedY+" Angle : "+ getMoveAngle();
	}
}
